
package data;

import java.sql.*;
/**
 *
 * @author Alejandro
 */
public class IniciarBitacorasGateway {

    private Connection conexion;

    public IniciarBitacorasGateway(){
        Conector conector = new Conector();
        conexion = conector.darConexion();
        Statement stmt;
        try {
            stmt = conexion.createStatement();
            stmt.execute("use be");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
    
    public void crearBitacora(String ID, String sigCurso, String numGrupo, String cedProf, String anio, String ciclo){
        Statement stmt; 
        try {      
            stmt = conexion.createStatement();
            stmt.execute("Insert into Bitacora (codigoBitacora, siglaCurso, numgrupo, cedulaProfesor, anio, ciclo) values (\'"+ID+"\', \'"+sigCurso+"\', \'"+numGrupo+"\', \'"+cedProf+"\',\'"+anio+"\',\'"+ciclo+"\')");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
    
    public void crearProfesor(String cedula) {
        Statement stmt; 
        try {      
            stmt = conexion.createStatement();
            stmt.execute("Insert into Profesor (cedula) values (\'"+cedula+"\')");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
    
    public void crearEstudianteLC(String codBit, String carnet, String nombre, String pApellido, String sApellido){
        Statement stmt; 
        try {      
            stmt = conexion.createStatement();
            stmt.execute("Insert into Estudiantes (carnet,nombre,primerApellido,segundoApellido) values (\'"+carnet+"\',\'"+nombre+"\',\'"+pApellido+"\',\'"+sApellido+"\')");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        try {      
            stmt = conexion.createStatement();
            stmt.execute("Insert into ListaClase (codigoBitacora,carnet) values (\'"+codBit+"\',\'"+carnet+"\')");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
    
    public void crearCartaEstudiante(String codBit, String siglaCurso){
        Statement stmt; 
        try {      
            stmt = conexion.createStatement();
            stmt.execute("insert into CartaEstudiante (siglaCurso,codigoBitacora,oficina,consulta,contenidos,objetivos,evaluacion,metodologia,bibliografia,cronograma) values (\'"+siglaCurso+"\',\'"+codBit+"\',\'-\',\'-\',\'-\',\'-\',\'-\',\'-\',\'-\',\'-\')");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
